29. Exercise: Edit Text Preference Constraints
Exercise Code
In this exercise, you will get to handle input errors to stop our app from crashing if the size value was not a valid input!
Edit Text Preference Constraints
SOLUTION:
- Update SettingsFragment to implement OnPreferenceChangeListener
- Override onPreferenceChange to convert the Preference value to float and show an error message if it failed to do so
- Add the OnPreferenceChangeListener specifically to the EditTextPreference